﻿//11.Write a program that converts a number in therange [0...999] to a text corresponding to its English pronunciation. 
//0 - "Zero"
//273 - "Two hundred seventy three"
//400 - "Four hundred"
//501 - "Five hundred and one"
//711 - "Seven hundred and eleven"

using System;

namespace AllEnglishNumbers
{
    class NumberNames
    {
        static void Main()
        {
             Console.Write("Please enter a number in the range 0-999: ");
             int number = int.Parse(Console.ReadLine());

             if (number >= 0 && number < 20)
             {
                 switch (number)
                {
                case 0: Console.WriteLine("zero"); break;
                case 1: Console.WriteLine("one"); break;
                case 2: Console.WriteLine("two"); break;
                case 3: Console.WriteLine("three"); break;
                case 4: Console.WriteLine("four"); break;
                case 5: Console.WriteLine("five"); break;
                case 6: Console.WriteLine("six"); break;
                case 7: Console.WriteLine("seven"); break;
                case 8: Console.WriteLine("eight"); break;
                case 9: Console.WriteLine("nine"); break;
                case 10: Console.WriteLine("ten"); break;
                case 11: Console.WriteLine("eleven"); break;
                case 12: Console.WriteLine("twelve"); break;
                case 13: Console.WriteLine("thirteen"); break;
                case 14: Console.WriteLine("fourteen"); break;
                case 15: Console.WriteLine("fifteen"); break;
                case 16: Console.WriteLine("sexteen"); break;
                case 17: Console.WriteLine("seventeen"); break;
                case 18: Console.WriteLine("eighteen"); break;
                default: Console.WriteLine("nineteen");break;
                }
             }

             else if (number >= 20 && number < 100)
             {
                 int tens = 0;

                 if (number / 10 == 2)
                 {
                tens = 2;
                 }
                 if (number / 10 == 3)
                 {
                tens = 3;
                 }
                if (number / 10 == 4)
                 {
                tens = 4;
                 }
                if (number / 10 == 5)
                {
                tens = 5;
                }
                if (number / 10 == 6)
                {
                tens = 6;
                }
                if (number / 10 == 7)
                {
                tens = 7;
                }
                if (number / 10 == 8)
                {
                tens = 8;
                }
                if (number / 10 == 9)
                {
                tens = 9;
                }

                switch (tens)
                {
                case 2: Console.Write("twenty "); break;
                case 3: Console.Write("thirty "); break;
                case 4: Console.Write("fourty "); break;
                case 5: Console.Write("fifty "); break;
                case 6: Console.Write("sixty "); break;
                case 7: Console.Write("seventy "); break;
                case 8: Console.Write("eighty "); break;
                default: Console.Write("ninety "); break;
                }

                int digits = 0;

                if (number % 10 == 0)
                {
                digits = 0;
                }
                if (number % 10 == 1)
                {
                digits = 1;
                }
                if (number % 10 == 2)
                {
                digits = 2;
                }
                if (number % 10 == 3)
                {
                digits = 3;
                }
                if (number % 10 == 4)
                {
                digits = 4;
                }
                if (number % 10 == 5)
                {
                digits = 5;
                }
                if (number % 10 == 6)
                {
                digits = 6;
                }
                if (number % 10 == 7)
                {
                digits = 7;
                }
                if (number % 10 == 8)
                {
                digits = 8;
                }
                if (number % 10 == 9)
                {
                digits = 9;
                }
                 
                 switch (digits)
                {
                case 0: Console.WriteLine(" "); break;
                case 1: Console.WriteLine("one"); break;
                case 2: Console.WriteLine("two"); break;
                case 3: Console.WriteLine("three"); break;
                case 4: Console.WriteLine("four"); break;
                case 5: Console.WriteLine("five"); break;
                case 6: Console.WriteLine("six"); break;
                case 7: Console.WriteLine("seven"); break;
                case 8: Console.WriteLine("eight"); break;
                default: Console.WriteLine("nine"); break;
               }
             }

             else if (number >= 100 && number <= 999)
             {
                 int hundreds = 0;

                 if (number / 100 == 2)
                 {
                     hundreds = 2;
                 }
                 if (number / 100 == 3)
                 {
                     hundreds = 3;
                 }
                 if (number / 100 == 4)
                 {
                     hundreds = 4;
                 }
                 if (number / 100 == 5)
                 {
                     hundreds = 5;
                 }
                 if (number / 100 == 6)
                 {
                     hundreds = 6;
                 }
                 if (number / 100 == 7)
                 {
                     hundreds = 7;
                 }
                 if (number / 100 == 8)
                 {
                     hundreds = 8;
                 }
                 if (number / 100 == 9)
                 {
                     hundreds = 9;
                 }

                 switch (hundreds)
                 {
                     case 2: Console.Write("twenty "); break;
                     case 3: Console.Write("thirty "); break;
                     case 4: Console.Write("fourty "); break;
                     case 5: Console.Write("fifty "); break;
                     case 6: Console.Write("sixty "); break;
                     case 7: Console.Write("seventy "); break;
                     case 8: Console.Write("eighty "); break;
                     default: Console.Write("ninety "); break;
                 }

                 int digits = 0;

                 if (number % 10 == 0)
                 {
                     digits = 0;
                 }
                 if (number % 10 == 1)
                 {
                     digits = 1;
                 }
                 if (number % 10 == 2)
                 {
                     digits = 2;
                 }
                 if (number % 10 == 3)
                 {
                     digits = 3;
                 }
                 if (number % 10 == 4)
                 {
                     digits = 4;
                 }
                 if (number % 10 == 5)
                 {
                     digits = 5;
                 }
                 if (number % 10 == 6)
                 {
                     digits = 6;
                 }
                 if (number % 10 == 7)
                 {
                     digits = 7;
                 }
                 if (number % 10 == 8)
                 {
                     digits = 8;
                 }
                 if (number % 10 == 9)
                 {
                     digits = 9;
                 }

                 switch (digits)
                 {
                     case 0: Console.WriteLine(" "); break;
                     case 1: Console.WriteLine("one"); break;
                     case 2: Console.WriteLine("two"); break;
                     case 3: Console.WriteLine("three"); break;
                     case 4: Console.WriteLine("four"); break;
                     case 5: Console.WriteLine("five"); break;
                     case 6: Console.WriteLine("six"); break;
                     case 7: Console.WriteLine("seven"); break;
                     case 8: Console.WriteLine("eight"); break;
                     default: Console.WriteLine("nine"); break;
                 }
             }
             else
             {
                 Console.WriteLine("Incorrect input!");
             }
        }
    }
}
